home *** CD-ROM | disk | FTP | other *** search
/ Champak 146 / (Vol 146) Jan 07 2012.iso / Games / the_great_candy_caper.swf / scripts / frame_3 / DoAction.as
Text File  |  2012-01-07  |  1KB  |  62 lines

  1. function spawnBot(randNum, mcRef)
  2. {
  3.    var randNum;
  4.    var mcRef;
  5.    if(mcRef == "spider")
  6.    {
  7.       var i = 0;
  8.       while(i < randNum)
  9.       {
  10.          attachMovie("spd_bot","spd_bot" + spidDepth,500 + spidDepth);
  11.          tmpMc = _root["spd_bot" + spidDepth];
  12.          tmpMc._y = - tmpMc._height;
  13.          i++;
  14.       }
  15.       spidDepth++;
  16.    }
  17.    if(mcRef == "bat")
  18.    {
  19.       var j = 0;
  20.       while(j < randNum)
  21.       {
  22.          attachMovie("bat_bot","bat_bot" + j,1000 + j);
  23.          j++;
  24.       }
  25.    }
  26.    if(mcRef == "candy")
  27.    {
  28.       var k = 1;
  29.       while(k < randNum)
  30.       {
  31.          attachMovie("candy","candy" + candyDepth,2000 + candyDepth);
  32.          tmpMc = _root["candy" + candyDepth];
  33.          tmpMc.gotoAndStop(randGen(4,1,true));
  34.          candyDepth++;
  35.          k++;
  36.       }
  37.    }
  38. }
  39. function randGen(range, flrVal, integer)
  40. {
  41.    var range;
  42.    var flrVal;
  43.    var randNum;
  44.    var integer;
  45.    if(integer)
  46.    {
  47.       randNum = Math.floor(Math.random() * range + flrVal);
  48.    }
  49.    else
  50.    {
  51.       randNum = Math.random() * range + flrVal;
  52.    }
  53.    return randNum;
  54. }
  55. var score = 30;
  56. var distance = 0;
  57. var spidDepth = 1;
  58. var time = 0;
  59. var spidDepth;
  60. var candyDepth = 10;
  61. stop();
  62.